﻿using System;
using UnityEngine;

// Token: 0x02000140 RID: 320
[AddComponentMenu("RVP/C#/Suspension/Suspension Property Setter", 3)]
public class PropertyToggleSetter : MonoBehaviour
{
	// Token: 0x060005D4 RID: 1492 RVA: 0x0002E669 File Offset: 0x0002C869
	private void Update()
	{
		if (!string.IsNullOrEmpty(this.changeButton) && Input.GetButtonDown(this.changeButton))
		{
			this.ChangePreset(this.currentPreset + 1);
		}
	}

	// Token: 0x060005D5 RID: 1493 RVA: 0x0002E69C File Offset: 0x0002C89C
	public void ChangePreset(int preset)
	{
		this.currentPreset = preset % this.presets.Length;
		if (this.steerer)
		{
			this.steerer.limitSteer = this.presets[this.currentPreset].limitSteer;
		}
		if (this.transmission)
		{
			this.transmission.skidSteerDrive = this.presets[this.currentPreset].skidSteerTransmission;
		}
		for (int i = 0; i < this.suspensionProperties.Length; i++)
		{
			for (int j = 0; j < this.suspensionProperties[i].properties.Length; j++)
			{
				this.suspensionProperties[i].SetProperty(j, this.presets[this.currentPreset].wheels[i].preset[j]);
			}
		}
	}

	// Token: 0x04000892 RID: 2194
	[Tooltip("Steering Controller")]
	public SteeringControl steerer;

	// Token: 0x04000893 RID: 2195
	public Transmission transmission;

	// Token: 0x04000894 RID: 2196
	[Tooltip("Suspensions with properties to be toggled")]
	public SuspensionPropertyToggle[] suspensionProperties;

	// Token: 0x04000895 RID: 2197
	public PropertyTogglePreset[] presets;

	// Token: 0x04000896 RID: 2198
	public int currentPreset;

	// Token: 0x04000897 RID: 2199
	[Tooltip("Input manager button which increments the preset")]
	public string changeButton;
}
